<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>元素/组件的过渡</title>
		<style type="text/css">
			.fade-enter-active, .fade-leave-active {
			  transition: opacity .5s;
			}
			.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
			  opacity: 0;
			}
		</style>
		<!-- 开发环境版本，包含了有帮助的命令行警告 -->
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
	</head>
	<body>
		<div id="demo">
		  <button v-on:click="show = !show">
		    Toggle
		  </button>
		  <!--针对单元素的过渡-->
		  <transition name="fade">
		    <p v-if="show">hello</p>
		 
		  </transition>
		  
		  <!--多个元素的过渡需要使用这个。而且必须指定key属性-->
		  <transition-group name="fade">
		  	<p v-if="show" key=1>意行春秋平千里</p>
		    <p v-show="show" key=2>烟尘一怒望偃月</p>
		  </transition-group>
		</div>
		<script type="text/javascript">
			new Vue({
			  el: '#demo',
			  data: {
			    show: true
			  }
			})
		</script>
	</body>
</html>
